package main.gui.settingsdialog;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.filechooser.FileFilter;

import main.core.Item;
import main.core.xml.XMLItems;
import main.core.xml.XMLItemsSaver;

public class SettingsPanel extends JPanel implements ActionListener{
	
	public static SettingsPanel getManualSettings()
	{
		SettingsPanel panel = new SettingsPanel();
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		
		return panel;
	}
	
	public void open()
	{
		SettingsPanel panel = new SettingsPanel();
		JFileChooser fs = new JFileChooser();
		//Show and accept .bps files
		fs.setFileFilter(new FileFilter() {
			@Override
			public boolean accept(File f) {
				if(f.isDirectory())
					return true;
				int start_extension = f.getName().lastIndexOf('.');
				if(f.getName().lastIndexOf('.') < 0)
					return false;
				else
				{
					String extension = f.getName().substring(start_extension);
					if(extension.equals(".bps"))
						return true;
				}
				return false;
			}

			@Override
			public String getDescription() {
			    return ".bps files";
			}
		});
		int code = fs.showOpenDialog(panel);
		if (code == JFileChooser.APPROVE_OPTION) {
            File file = fs.getSelectedFile();
            try {
            	
			} catch (Exception e) {
				e.printStackTrace();
			}
        }
	}

	@Override
	public void actionPerformed(ActionEvent event) {
	}
}
